/**
 * The BigTwoCard class is a subclass of the Card class and is used to model a card used in a Big Two card game.
 * @author Xu Chen
 */

public class BigTwoCard extends Card{
	/**
	 * a constructor for model a card used in a Big Two card game
	 * @param suit (integer between 0 and 3)
	 * @param rank (integer between 0 and 12)
	*/
	public BigTwoCard(int suit, int rank) {
		super(suit,rank);
	}
	
	/**
	 * a method for comparing the order of this card with the specified card.
	 * @param card, is the card compared to this
	 * @return a negative integer, zero, or a positive integer when this card is less than, equal to, or greater than the specified card.
	 */
	public int compareTo(Card card) {
		var temp_this_rank =this.rank;
		var temp_card_rank =card.rank;
		if (temp_this_rank == 0) {
			temp_this_rank = 13;
		}
		if (temp_card_rank == 0) {
			temp_card_rank = 13;
		}
		if (temp_this_rank == 1) {
			temp_this_rank = 14;
		}
		if (temp_card_rank == 1) {
			temp_card_rank = 14;
		}
		
		if(temp_this_rank<temp_card_rank) {
			return -1;
		}else if (temp_this_rank>temp_card_rank) {
			return 1;
		}else if (temp_this_rank==temp_card_rank) {
			if (this.suit>card.suit) {
				return 1;
			}else if (this.suit<card.suit) {
				return -1;
			}else if (this.suit == card.suit) {
				return 0;
			}
		}else {
			return 0;
		}
		return 0;
	}
}